<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const obj = {
    a:10,
    b:20,
    c:function(){
      console.log("cccc")
    }
  }


  function Parent(msg){
    this.msg = msg;
  }
  Parent.prototype.show = function(){
    console.log(this.msg);
  }


  function Child(){}

  // Child.prototype = Parent.prototype;
  for(let i in Parent.prototype){
    Child.prototype[i] = Parent.prototype[i];
  }
  for(let i in obj){
    Child.prototype[i] = obj[i];
  }
  Child.prototype.show = function(){
    console.log("Child的show")
  }


  const p1 = new Parent("hello");
  console.log(p)
  p.show();
  
  const c = new Child("world");
  console.log(c);
  c.show();


  
</script>
</html>